package com.deke.teacher.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.deke.teacher.dao.CheckTeacherDao;
import com.deke.teacher.service.CheckTeacherService;
import com.deke.entity.CheckTeacherVo;
import com.deke.teacher.vo.EduCheckVo;
import com.deke.vo.Result;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author ：张恒（1371745897@qq.com）
 * @date ：Created in 2022/12/7 16:50
 * @description：
 * @modified By：
 * @version:
 */
@Service
public class CheckTeacherServiceImpl implements CheckTeacherService {

    @Resource
    private CheckTeacherDao checkTeacherDao;

    /**
     * 查询所有
     * @param eduCheckVo 实体类
     * @param current 每页几条数据
     * @param pageSize 第几页
     * @return
     */
    @Override
    public Result<IPage<EduCheckVo>> queryByConditionPage(EduCheckVo eduCheckVo, Integer current, Integer pageSize) {
        IPage<EduCheckVo> iPage=new Page<>(current,pageSize);
        IPage<EduCheckVo> page = checkTeacherDao.findAll(iPage, eduCheckVo);
        return new Result(2000,"查询成功",page);
    }

    /**
     * 审核状态的修改
     * @param checkTeacherVo 实体类
     * @return
     */
    @Override
    public Result updateCheckStatusById(CheckTeacherVo checkTeacherVo) {
        int i = checkTeacherDao.updateById(checkTeacherVo);
        if (i>0){
            return new Result(2000,"修改审核状态成功");
        }
        return new Result(5000,"修改审核状态失败");
    }
}